import java.util.*;

public class demo08{
    public static int[] getX = {0, 1, 0, -1};
    public static int[] getY = {1, 0, -1, 0};

    public static int cnt = 0;

    public static void dfs(char[][] a, boolean[][] st, int x, int y){
        st[x][y] = true;
        for(int i = 0; i < 4; i++){
            int newx = x + getX[i];
            int newy = y + getY[i];
            if(newx >= 0 && newx < 30 && newy >= 0 && newy < 60 && a[newx][newy] == '1' && st[newx][newy] == false){
                cnt++;
                dfs(a, st, newx, newy);
            }
        }
    }

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        char[][] a = new char[35][65];
        boolean[][] st = new boolean[35][65];
        for(int i = 0; i < 30; i++){
            String s = scanner.next();
            a[i] = s.toCharArray();
        }
        int res = 0;
        for(int i = 0; i < 30; i++){
            for(int j = 0; j < 60; j++){
                if(a[i][j] == '1' && !st[i][j]){
                    cnt = 1;
                    dfs(a, st, i, j);
                    res = Math.max(res, cnt);
                }
            }
        }
        System.out.println(res);
    }
}
